#pragma once

//
// Class controls monitoring of the Event Log messages.  It initalizes COM and creates the 
// Monitor object.  You call WaitForEvt to check for the event.
//

class CEventMonWbem
{
public:
	CEventMonWbem();
	~CEventMonWbem(void);

private:
	IWbemServices *m_pSvc;
	IWbemLocator *m_pLoc;
	IEnumWbemClassObject *m_EvtObj;

public:
	//
	// Initializes the Wbem Object and adjusts the security.
	//
	bool Init(void);
	//
	// Adjusts the security token for SeSecurityPrivilege so that we can read
	// the event log.
	//
	bool AdjustProcessSecurity(void);
	//
	// Uses the Monitor Event created by MonitorEvt to wait for
	// an event to be fired.
	//
	HRESULT MonitorEvt(WCHAR * m_EventNum, WCHAR * EventLog);
	//
	// Uses the Monitor Event created by MonitorEvt to wait for
	// an event to be fired.
	//
	HRESULT WaitForEvt(int long, ULONG * NumEvents);
};
